package com.pdf.generate_pdf.controller;

import com.pdf.generate_pdf.service.GeneratePdfService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author zzt
 * @date 2021/12/7
 */
@RestController
public class GeneratePdfController {

    @Autowired
    private GeneratePdfService generatePdfService;

    /**
     * 添加模板
     *
     * @param template
     * @return
     */
    @PostMapping("pdf/addTemplate")
    public String addTemplateController(MultipartFile template) {
        return generatePdfService.addTemplateService(template);
    }

    /**
     * 生成pdf
     * @param id
     * @return
     */
    @PostMapping("pdf/generatePdf")
    public String generatePdfController(@Param("id") String id)   {
        return generatePdfService.generatePdfService(id);
    }
}
